import { reactive } from 'vue'
import axios from 'axios'

export default function () {
  let dogList = reactive([
    'https://images.dog.ceo/breeds/pembroke/n02113023_1616.jpg',
    'https://images.dog.ceo/breeds/pembroke/n02113023_1482.jpg'
  
  ])
  
  const getDog = async () => {
    try {
      let res =  await axios.get('https://dog.ceo/api/breed/pembroke/images/random')
      dogList.push(res.data.message)
      // console.log(res.data.message)
    }catch(error) {
      // error -> 错误对象
      alert(error)
    }
  }
  return { dogList, getDog }
}
